(() => {
    let ele = {};

    ele.btn = $('#btn');

    ele.account = $('#account');//游戏账号
    ele.password = $('#password');//游戏密码


    getInfo()
    function getInfo() {
        let token = getCookie("token");
        let userid = getCookie("userid");
        ajax({
            url: API_PATH.GAMEINFO,
            method: 'GET',
            header: {
                Authorization: token
            },
            success: res => {
                if (res.code == 1) {
                    ele.account.innerHTML = res.data.account
                    ele.password.innerHTML = res.data.pwd
                }
                else openTips(res.msg);
            }
        });
    }

    var ua = navigator.userAgent.toLowerCase();
    const gamelink = 'https://sy.1n.cn/index.php?s=/Home/Index/game_view/promote_id/38624/game_id/2967.html'

    ele.btn.onclick = () => {
        if (/(iPhone|iPad|iPod|iOS)/i.test(ua)) {
            location.href = gamelink;
        } else if (/(Android)/i.test(ua)) {
            plus.runtime.openURL(gamelink);
            // location.href = gamelink;
        } else {
            location.href = gamelink;
        }
    }

    ele.qrCode = $('#qr-code');
    let qr = new QRCode(ele.qrCode, {
        text: gamelink,
        width: 74,
        height: 74,
        correctLevel: QRCode.CorrectLevel.L
    });


})();